/** BufferManager Modified by LU JINBO@NOV 1st**/

package qp.optimizer;

public class BufferManager{

	static int numBuffer;
    static int numJoin;
    static int buffPerJoin;
    static int bufferForSort;

    public BufferManager(int numBuffer, int numJoin){
		this.numBuffer = numBuffer;
		this.numJoin = numJoin;
		if(numJoin!=0)
		{
			buffPerJoin = numBuffer/numJoin;
		    bufferForSort=buffPerJoin;
		}
		else
		{
			buffPerJoin = 5;
		    bufferForSort = 5;
		}
    }

    public static int getBuffersPerJoin(){
		return buffPerJoin;
    }
    
    public static int getBufferForSort() {
    	return bufferForSort;
    }
	
	//Get all the buffer user gives
    public static int getAllBuffer() {
    	return numBuffer;
    }

}
